<?php
include('../../inc/global.inc');
include("../islogin.php");
$url=$_SERVER['HTTP_REFERER'];
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
<script type='text/javascript' src="../js/shijian.js" charset="gb2312"></script>
<script type="text/javascript" src="/js/city.js" charset="gb2312"></script>
<script type="text/javascript" src="/js/job_class.js" charset="gb2312"></script>
</HEAD>
<BODY>
<?php
if($_POST['act_xg']){
         $j_rs_1=mysql_query("select * from job_class where id='$_POST[job_class]'");
	     $j_row_1=mysql_fetch_array($j_rs_1);
	     $j_rs_2=mysql_query("select * from job_class where id='$_POST[job_smill]'");
	     $j_row_2=mysql_fetch_array($j_rs_2);
		 $job_class=($_POST[job_class])?$_POST[job_class]:0;
	     $job_smill=($_POST[job_smill])?$_POST[job_smill]:0;
		 $job_hy=explode("@",$_POST[job_hy]);
		 $job_sh=($_POST[job_sh])?$_POST[job_sh]:0;
		$qw_rs=@mysql_query("select * from city where id='$_POST[c_provinces4]'");
		$qw_row=@mysql_fetch_array($qw_rs);
		$qw_rs2=@mysql_query("select * from city where id='$_POST[c_city4]'");
		$qw_row2=@mysql_fetch_array($qw_rs2);
		$qw_rs3=@mysql_query("select * from city where id='$_POST[c_diqu4]'");
		$qw_row3=@mysql_fetch_array($qw_rs3);
		
		$job_pro_id=$_POST[c_provinces4]?$_POST[c_provinces4]:0;
		$job_city_id=$_POST[c_city4]?$_POST[c_city4]:0;
		$job_dq_id=$_POST[c_diqu4]?$_POST[c_diqu4]:0;
		 
@mysql_query("update job_post set job_title='$_POST[job_title]',job_nature='$_POST[job_nature]',job_pro_id='$job_pro_id',job_pro='$qw_row[city_name]',job_city_id='$job_city_id',job_city='$qw_row2[city_name]',job_dq_id='$job_dq_id',job_dq='$qw_row3[city_name]',job_area='$_POST[job_area]',job_num='$_POST[job_num]',job_sex='$_POST[job_sex]',job_effe='$_POST[job_effe]',job_exp='$_POST[job_exp]',job_edu='$_POST[job_edu]',job_lan='$_POST[job_lan]',job_salary='$_POST[job_salary]',job_class_id='$job_class',job_class_id2='$job_smill',job_class='$j_row_1[j_c_name]',job_class2='$j_row_2[j_c_name]',job_hy_id='$job_hy[0]',job_hy='$job_hy[1]',job_tel='$_POST[job_tel]',job_email='$_POST[job_email]',job_describe='$_POST[job_describe]',job_notes='$_POST[job_notes]',job_cl='1',job_sh='$job_sh' where id='".$_POST['iid']."'");

echo "<script>alert('编辑成功');location='".$_POST['urls']."'</script>";
}
?>
  <table width="780" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">招聘岗位编辑&nbsp;&nbsp;<a href="javascript:history.go(-1)">Back</a></td>
    </tr>
</table>
<?php
$sql="select * from job_post where id=".$_GET['xg_id'];
$j_rs=mysql_query($sql);
$j_row=mysql_fetch_array($j_rs)
?>
<table cellspacing="1" cellpadding="0" width="780" align="center" bgcolor="#000000" border="0">
  <form action="index_modify.php" method="post" name="form1"  onSubmit="return checkform()">
      <tr>
        <td align="center" bgcolor="#8DA8CF" colspan="2" height="45">招聘岗位编辑</td>
      </tr>
          <TR>
            <td width="17%" height="25" align="center" bgcolor="#EFF6FF">岗位名称</td>
            <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="job_title" id="job_title" type="text" size="50" maxlength="200" value="<?=$j_row[job_title]?>"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">职位类别</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;line-height:35px;">
			<select name="job_class" id="job_class" onChange="changejobtype(document.form1.job_class.options[document.form1.job_class.selectedIndex].value)" style="width:190px;">
                <option value="">选择、修改</option>
			<?php
				$rs=@mysql_query("select * from job_class  where j_c_id=0");
				while($row=@mysql_fetch_array($rs)){?>
				<option value="<?=$row['id']?>" <?php if($j_row[job_class_id]==$row['id']){echo "selected";}?>><?=$row[j_c_name]?></option>
			<?php }?></select>&nbsp;<select name="job_smill" id="job_smill" style="width:190px;">
			          <option value="">选择、修改</option>
			          <?php 
					    $rs2=mysql_query("select * from job_class where id='$j_row[job_class_id2]' order by id asc");
						while($row2=mysql_fetch_array($rs2)){
					  ?><option value="<?=$row2['id']?>" selected><?=$row2[j_c_name]?></option>
					  <?php }?>
                     </select></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">行业类别</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select name="job_hy" id="job_hy" style="width:190px;">
                            <option value="">选择、修改</option>
							  <?php
							     $rs=@mysql_query("select * from job_hy where job_hy_id=0");
								 while($row=@mysql_fetch_array($rs)){
							  ?><option value="<?=$row['id']?>@<?=$row[job_hy_name]?>" <?php if($j_row[job_hy_id ]==$row['id']){echo "selected";}?>><?=$row[job_hy_name]?></option>
							  <?php }?>
                          </select></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">岗位性质</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select name="job_nature" id="job_nature">
			   <option value="1" <?php if($j_row[job_nature]==1){echo "selected";}?>>全职</option>
			   <option value="2" <?php if($j_row[job_nature]==2){echo "selected";}?>>兼职</option>
			   <option value="3" <?php if($j_row[job_nature]==3){echo "selected";}?>>实习</option>
			</select></TD>
          </TR>
		  <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">学历要求</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select name="job_edu" id="job_edu">
              <option value="1" <?php if($j_row[job_edu]==1){echo "selected";}?>>不限</option>
              <option value="2" <?php if($j_row[job_edu]==2){echo "selected";}?>>高中</option>
              <option value="3" <?php if($j_row[job_edu]==3){echo "selected";}?>>技校</option>
              <option value="4" <?php if($j_row[job_edu]==4){echo "selected";}?>>中专</option>
              <option value="5" <?php if($j_row[job_edu]==5){echo "selected";}?>>大专</option>
              <option value="6" <?php if($j_row[job_edu]==6){echo "selected";}?>>本科</option>
              <option value="7" <?php if($j_row[job_edu]==7){echo "selected";}?>>硕士</option>
              <option value="8" <?php if($j_row[job_edu]==8){echo "selected";}?>>博士</option>
            </select></TD>
          </TR>
		  <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">工作经验</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;">
			<select name="job_exp" id="job_exp">
              <option value="1" <?php if($j_row[job_exp]==1){echo "selected";}?>>不限</option>
              <option value="2" <?php if($j_row[job_exp]==2){echo "selected";}?>>1年以下</option>
              <option value="3" <?php if($j_row[job_exp]==3){echo "selected";}?>>1-2年</option>
              <option value="4" <?php if($j_row[job_exp]==4){echo "selected";}?>>3-5年</option>
              <option value="5" <?php if($j_row[job_exp]==5){echo "selected";}?>>6-7年</option>
              <option value="6" <?php if($j_row[job_exp]==6){echo "selected";}?>>8-10年</option>
              <option value="7" <?php if($j_row[job_exp]==7){echo "selected";}?>>10年以上</option>
            </select></TD>
          </TR> 
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">性别要求</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;">
			<select name="job_sex" id="job_sex">
                <OPTION value="1" <?php if($j_row[job_sex]==1){echo "selected";}?>>不限</OPTION>
                <OPTION value="2" <?php if($j_row[job_sex]==2){echo "selected";}?>>男</OPTION>
                <OPTION value="3" <?php if($j_row[job_sex]==3){echo "selected";}?>>女</OPTION>
			</SELECT></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">招聘人数</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="job_num" type="text" id="job_num" value="<?=$j_row[job_num]?>" size="10" maxlength="50">
            人</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">有效日期</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select name="job_effe" id="job_effe">
                <OPTION value="1" <?php if($j_row[job_effe]==1){echo "selected";}?>>--长期有限--</OPTION>
                <OPTION value="2" <?php if($j_row[job_effe]==2){echo "selected";}?>>3天</OPTION>
                <OPTION value="3" <?php if($j_row[job_effe]==3){echo "selected";}?>>5天</OPTION>
				<OPTION value="4" <?php if($j_row[job_effe]==4){echo "selected";}?>>7天</OPTION>
				<OPTION value="5" <?php if($j_row[job_effe]==5){echo "selected";}?>>半个月</OPTION>
				<OPTION value="6" <?php if($j_row[job_effe]==6){echo "selected";}?>>一个月</OPTION>
				<OPTION value="7" <?php if($j_row[job_effe]==7){echo "selected";}?>>三个月</OPTION>
				<OPTION value="8" <?php if($j_row[job_effe]==8){echo "selected";}?>>半年</OPTION>
				<OPTION value="9" <?php if($j_row[job_effe]==9){echo "selected";}?>>一年</OPTION>
			</SELECT></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">语言能力</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="job_lan" id="job_lan" type="text" value="<?=$j_row[job_lan]?>" size="30" maxlength="50">&nbsp;例：英语-CET4</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">薪金范围</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><SELECT name="job_salary" id="job_salary">
			  <OPTION value="1" <?php if($j_row[job_salary]==1){echo "selected";}?>>面谈</OPTION>
              <OPTION value="2" <?php if($j_row[job_salary]==2){echo "selected";}?>>1000元/月以下</OPTION>
              <OPTION value="3" <?php if($j_row[job_salary]==3){echo "selected";}?>>1000-2000元/月</OPTION>
              <OPTION value="4" <?php if($j_row[job_salary]==4){echo "selected";}?>>2001-4000元/月</OPTION>
              <OPTION value="5" <?php if($j_row[job_salary]==5){echo "selected";}?>>4001-6000元/月</OPTION>
              <OPTION value="6" <?php if($j_row[job_salary]==6){echo "selected";}?>>6001-8000元/月</OPTION>
              <OPTION value="7" <?php if($j_row[job_salary]==7){echo "selected";}?>>8001-10000元/月</OPTION>
              <OPTION value="8" <?php if($j_row[job_salary]==8){echo "selected";}?>>10001-15000元/月</OPTION>
              <OPTION value="9" <?php if($j_row[job_salary]==9){echo "selected";}?>>15000-25000元/月</OPTION>
              <OPTION value="10" <?php if($j_row[job_salary]==10){echo "selected";}?>>25000元/月以上</OPTION>
            </SELECT></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">联系电话</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="job_tel" id="job_tel" type="text" size="20" maxlength="40" value="<?=$j_row[job_tel]?>"> 
              &nbsp;如：人事部电话</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">招聘邮箱</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="job_email" id="job_email" type="text" size="35" maxlength="100" value="<?=$j_row[job_email]?>">
&nbsp;如：人事部E_mail</TD>
          </TR>
		  <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">工作城市</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select  name="c_provinces4" id="c_provinces4" onChange="changecity4(document.form1.c_provinces4.options[document.form1.c_provinces4.selectedIndex].value)">
            <option value="">省份</option>
          <?php
          $result = mysql_query("select * from city where city_id=0");    
          while($res = mysql_fetch_array($result)){    
          ?>    
          <option value="<?=$res['id']?>" <?php if($j_row[job_pro_id]==$res[id]){echo "selected";}?>><?=$res['city_name']?></option> 
          <?php }?>   
       </select>
			<select name="c_city4" id="c_city4" onFocus="changecity4(document.form1.c_provinces4.options[document.form1.c_provinces4.selectedIndex].value)">
			   <option value="">城市</option>
			   <?php
				$rs=@mysql_query("select * from city where city_id='$j_row[job_pro_id]' order by city_ping asc");
				while($row=@mysql_fetch_array($rs)){
			   ?><option value="<?=$row['id']?>" <?php if($j_row[job_city_id]==$row['id']){echo "selected";}?>><?=$row[city_name]?></option>
			 <?php }?>
			</select>
			<select name="c_diqu4" id="c_diqu4" onFocus="changecity5(document.form1.c_city4.options[document.form1.c_city4.selectedIndex].value)">
                 <option value="">地区</option>
				 <?php
				   $rs2=@mysql_query("select * from city where city_id='$j_row[job_city_id]'");
				   while($row2=@mysql_fetch_array($rs2)){
				 ?>
				 <option value="<?=$row2['id']?>" <?php if($row2[id]==$j_row[job_dq_id]){echo "selected";}?>><?=$row2['city_name']?></option>
				 <?php }?>
            </select></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">工作地点</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="job_area" type="text" size="45" maxlength="100" value="<?=$j_row[job_area]?>"></TD>
          </TR>
		  <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">职位描述</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><textarea name="job_describe" id="job_describe" cols="70" rows="20"><?=$j_row[job_describe]?></textarea></TD>
          </TR>
		  <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">注意事项</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><textarea name="job_notes" id="job_notes" cols="70" rows="4"><?=$j_row[job_notes]?></textarea></TD>
          </TR>
	 <tr>
	   <td height="45" colspan="2" align="center" bgcolor="#8DA8CF">管理员处理</td>
    </tr>
	 <tr>
	   <td height="25" align="center" bgcolor="#EFF6FF">审核通过</td>
	   <td bgcolor="#ffffff" style="padding-left:3px;"><input type="radio" name="job_sh" value="1" <?php if($j_row[job_sh]==1){echo "checked";}?>>
	   是
	     <input type="radio" name="job_sh" value="0" <?php if($j_row[job_sh]==0){echo "checked";}?>>
	     否</td>
    </tr>
	 <tr>
	   <td height="25" align="center" bgcolor="#EFF6FF">&nbsp;</td>
	   <input type="hidden" name="iid" value="<?=$j_row[id]?>"><input type="hidden" name="urls" value="<?=$url?>">
	   <td bgcolor="#ffffff" style="padding-left:3px;"><input type="submit" value="提交">
	   <input type="hidden" name="act_xg" value="ok"></td>
    </tr>
 </form>                
</TABLE>
</BODY>
</HTML>

<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){
   if($("job_title").value==""){
      alert("岗位名称不能为空");
      $("job_title").focus();
      return false;
   }
   if($("job_class").value==""){
      alert("选择职位类别");
      $("job_class").focus();
      return false;
   }
   if($("job_smill").value==""){
      alert("选择职位类别");
      $("job_smill").focus();
      return false;
   }

   if($("job_hy").value==""){
      alert("选择行业类别");
      $("job_hy").focus();
      return false;
   }   

   if($("job_tel").value==""){
      alert("联系电话不能为空");
      $("job_tel").focus();
      return false;
   }
   if($("job_email").value==""){
      alert("邮箱不能为空");
      $("job_email").focus();
      return false;
   } 
   if($("job_city").value==""){
      alert("工作城市不能为空");
      $("job_city").focus();
      return false;
   }    
   
   if($("job_area").value==""){
      alert("工作地不能为空");
      $("job_area").focus();
      return false;
   }   
    if($("job_describe").value==""){
      alert("职位描述不能为空");
      $("job_describe").focus();
      return false;
   }   
}
</script>